import java.util.*;
import java.io.*;

public class GenTPMaj{
    // 
    public static void main(String[] args){
        // Pulling parameter: length of boolean vector and output file name
        final int n = Integer.parseInt(args[0]);
        final int nIC = (int)Math.pow(2.,(double)n);
        final String oFile = args[1];
        // Define headers
        final String head1 = "Evaluated: F\nFitness: f0000000000|0.0|";
        final String head2 = "i"+n+"|";
        MF mf = new MF();
        int[][] allIC = mf.allIC_Generate(n);
        
        // Open Output
        PrintWriter outf;
        try {  // Create the output stream.
            outf = new PrintWriter(new FileWriter(oFile));
        }
        catch (IOException e) {
            System.out.println("Can't open file "+oFile+"!");
            System.out.println("Error: " + e);
            return;        // End the program.
        }
        
        // Output
        for(int i=0; i<nIC;i++){
            outf.println(head1);
            outf.println(head2+intToBoolString(allIC[i]));
        }
        outf.close();
        System.out.println("Done!");
    }
    
    public static String intToBoolString(final int[] a){
        String result="";
        for(int i=0; i< a.length;i++){
            if(a[i]==1)
                result += "T";
            else
                result += "F";
        }
        return result;
    }
}
